<?php
namespace Plugin\Device\Schema;

use Plugin\Device\Model\RdDeviceBroadcast;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 广播设备
 */
#[Schema(title: 'RdDeviceBroadcastSchema')]
class RdDeviceBroadcastSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'id', type: 'bigint')]
    public string $id;

    #[Property(property: 'code', title: '设备编码', type: 'varchar')]
    public string $code;

    #[Property(property: 'name', title: '设备名称', type: 'varchar')]
    public string $name;

    #[Property(property: 'server_id', title: '服务器id', type: 'bigint')]
    public string $server_id;

    #[Property(property: 'ip', title: '设备ip', type: 'varchar')]
    public string $ip;

    #[Property(property: 'device_id', title: '设备编号', type: 'bigint')]
    public string $device_id;

    #[Property(property: 'rod_id', title: '装置ID', type: 'bigint')]
    public string $rod_id;

    #[Property(property: 'status', title: '设备状态', type: 'tinyint')]
    public string $status;

    #[Property(property: 'volume', title: '音量', type: 'int')]
    public string $volume;

    #[Property(property: 'remarks', title: '备注', type: 'varchar')]
    public string $remarks;

    #[Property(property: 'addr', title: '位置', type: 'varchar')]
    public string $addr;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;

    #[Property(property: 'created_by', title: '创建者', type: 'bigint')]
    public string $created_by;

    #[Property(property: 'updated_by', title: '更新者', type: 'bigint')]
    public string $updated_by;

    #[Property(property: 'stand_id', title: '站点id', type: 'int')]
    public string $stand_id;




    public function __construct(RdDeviceBroadcast $model)
    {
       $this->id = $model->id;
       $this->code = $model->code;
       $this->name = $model->name;
       $this->server_id = $model->server_id;
       $this->ip = $model->ip;
       $this->device_id = $model->device_id;
       $this->rod_id = $model->rod_id;
       $this->status = $model->status;
       $this->volume = $model->volume;
       $this->remarks = $model->remarks;
       $this->addr = $model->addr;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;
       $this->created_by = $model->created_by;
       $this->updated_by = $model->updated_by;
       $this->stand_id = $model->stand_id;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'code' => $this->code ,'name' => $this->name ,'server_id' => $this->server_id ,'ip' => $this->ip ,'device_id' => $this->device_id ,'rod_id' => $this->rod_id ,'status' => $this->status ,'volume' => $this->volume ,'remarks' => $this->remarks ,'addr' => $this->addr ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at ,'created_by' => $this->created_by ,'updated_by' => $this->updated_by ,'stand_id' => $this->stand_id];
    }
}